# _*_ coding: utf-8 _*_
from odoo import models, api


class ViewQuantMixin(models.AbstractModel):
    _name = "stock.view.quant.mixin"

    @api.multi
    def action_view_quant_by_product_ids(self, product_ids):
        self.ensure_one()
        action = self.env.ref("stock.quantsact")
        if not action:
            return True

        action_dict = action.read()[0]

        domain = [
            ("product_id", "in", product_ids)
        ]
        action_dict["domain"] = domain

        return action_dict
